package Function.ItemUse;

import FCRendering.FCRBattleOrderConstant;
import VWorldGameStudio.*;

import static FCRendering.FCRMaster.fcv;

public class ToolJunHao extends AItemUse{
    @Override
    public ItemUseResult directUse() {
        return useForPlayerTarget(keepPlayer);
    }

    @Override
    public ItemUseResult useInMapTarget(int x, int y) {
        return  useForPlayerTarget(keepPlayer);
    }

    @Override
    public ItemUseResult useForMonsterTarget(FCBattleOrder battleOrder, FCMonster m) {
        return new ItemUseResult().useless();
    }

    @Override
    public ItemUseResult useForPlayerTarget(FCPlayerInfo p) {
        fcv.closeAllShowWindw();
        if(!fcv.isBattle()) {
            fcv.getMessage().add("只能在战斗中使用，什么也没发生");
            fcv.showMessage();
            return new ItemUseResult().useless();
        }
        if(p.isDeath()){
            fcv.getMessage().add("不能给死者使用,什么也没发生");
            fcv.showMessage();
            return new ItemUseResult().useless();
        }
        FCPlayerBattleWrap wrap = FCPlayerBattleWrap.findBattleWrapByName(p.getAliasUID(), p.getName());
        int defense = p.getPlayerWuliDefend();
        //防御的俩倍+100
        wrap.addlongTermState(FCRBattleOrderConstant.S_Defense, defense*2+100, 3);
        int attack = p.getStrength()+50;
        //强度+50
        wrap.addlongTermState(FCRBattleOrderConstant.S_AddAttack, attack, 3);
        useAfter();
        fcv.getMessage().add("给"+p.getChName()+"大大增强了自身威力");
        fcv.showMessage();
        return new ItemUseResult();
    }

    @Override
    public ItemUseResult useForTankTarget(FCTank t) {
        return  useForPlayerTarget(keepPlayer);
    }
}
